package com.hutu.controller.biz.admin;

import com.hutu.model.biz.PublicVars;
import com.hutu.model.resp.ResponseVo;
import com.hutu.service.biz.PublicVarsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
/**
 * <p>
 * 模板 Controller (废弃)
 * </p>
 *
 * @author admin
 * @since 2023-07-20
 */
@RestController
@RequestMapping("/admin/public-vars")
@Api(tags = "模板")
public class PublicVarsController {
    @Resource
    private PublicVarsService publicVarsService;

    @ApiOperation("新增")
    @PostMapping("/add")
    public ResponseVo add(@RequestBody PublicVars publicVars){
        return this.publicVarsService.add(publicVars);
    }

    @ApiOperation("逻辑删除")
    @DeleteMapping("/{id}")
    public ResponseVo delete(@PathVariable Integer id){
        return this.publicVarsService.deleteById(id);
    }

    @ApiOperation("批量逻辑删除")
    @DeleteMapping("/batch/{ids}")
    public ResponseVo deleteBatch(@PathVariable List<Integer> ids){
        return this.publicVarsService.deleteBatch(ids);
    }

    @ApiOperation("编辑更新")
    @PutMapping
    public ResponseVo edit(@RequestBody PublicVars publicVars){
        return this.publicVarsService.edit(publicVars);
    }

    @ApiOperation("查询")
    @GetMapping("/{id}")
    public ResponseVo findById(@PathVariable Integer id){
        return this.publicVarsService.findById(id);
    }

    @ApiOperation("分页条件查询")
    @PostMapping("/page")
    public ResponseVo list(@RequestParam(defaultValue = "1") Integer current,@RequestParam(defaultValue = "10") Integer size,String name){
        return this.publicVarsService.list(current,size,name);
    }

}

